package com.bluefox.hospital.service;

import com.bluefox.hospital.model.Announcement;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * AnnouncementService
 */
public interface AnnouncementService {

    /**
     * 根据ID获取资源
     *
     * @param id 资源实例ID
     * @return Id所指向的资源实例
     * @throws 当Id所指向的资源不存在时，抛CustomRuntimeException异常
     */
    Announcement get(Long id);

    /**
     * 创建
     *
     * @param model 资源实例
     * @return 创建后的对象
     */
    Announcement create(Announcement model);

    /**
     * 更新
     *
     * @param model 编辑后的资源实例
     * @return 修改后的对象
     */
    Announcement update(Announcement model);

    /**
     * 删除
     *
     * @param id 资源实例ID
     */
    void delete(Long id);
    public Page<Announcement> findAll(Pageable pageable);

    @Transactional(propagation= Propagation.NOT_SUPPORTED)
    Page<Announcement> findAll(String type, Pageable pageable);

    Page<Announcement> findAllWeb(Pageable pageable);

    Page<Announcement> findAllWeb(String type, Pageable pageable);

    Page<Announcement> findByTypeAndStatus(String type, int i, Pageable pageable);

    /**
     * 置顶操作
     * @param model
     * @return
     */
    Announcement roofPlacement(Announcement model);
}
